<?php
/**
 * -------------------------------------------------------------
 * @example 判断一个字符是否在另一个字符内
 * @author wolf [Email: 116311316@qq.com]
 * Smarty plugin
 * -------------------------------------------------------------
 */
function smarty_block_range($params, $content, &$smarty)
{
	//Benchmark::print_r($params);
    $needle = $params['needle'];
    $haystack = $params['haystack'];
    $oppsite=$params['opposite'];
    if ($haystack == '') {
        return FALSE;
    }
    if (in_array($needle, $haystack)) {
        return $content;
    } else {
        return $oppsite;
    }
}
